﻿@model QuanLyGiaoVuUI.Models.MonHoc.ThemMonHocBoMonViewModel
@{
    Layout = null;
}


<div id="page-heading">
    <div class="block">
        @{Html.EnableClientValidation();}
        @using (Ajax.BeginForm("ThemMonHocBoMon", "MonHoc", new AjaxOptions
        {
            HttpMethod = "POST",
            OnSuccess = "ThemMonHocBoMonSuccess"
        }))
        {
            <table class="form" style="width: 100%">
                <tr>
                    <td>
                        <div class="editor-label">
                            @Html.LabelFor(m => m.MaBoMon)
                        </div>
                    </td>
                    <td>
                        @Html.DropDownListFor( m => m.MaBoMon, new SelectList(Model.DanhSachBoMon, "MaBoMon", "TenBoMon"))
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="editor-label">
                            @Html.LabelFor(m => m.MaMonHoc)
                        </div>
                    </td>
                    <td>
                        <div class="editor-field">
                            @Html.DropDownListFor(m => m.MaMonHoc, new SelectList(Model.DanhSachMonHoc, "ID", "MaVaTenMonHoc"))
                        </div>
                    </td>
                </tr>
            </table>
            <p>
                <input id="btnSubmitThemMonHoc" style="display: none" type="submit"/>
            </p>
        }
    </div>
</div>

<script>
    $(document).ready(function () {

    });

    function ThemMonHocBoMonSuccess(data) {
        if (data.success == true) {
            window.location = "/MonHoc/BoMon?maBoMon=" + $("#MaBoMon").val();
        }
        else {
            ToastManager.showStickyWarningToast(data.message);
        }
    }

    var ThemMonHocBoMon = new function () {
        this.SubmitForm = function () {
            $("#btnSubmitThemMonHoc").trigger("click");
        }
    }
</script>
